<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	
	<body>
		
		<input id="num1Input" type="text"/>
		<select id="signSelect">
			<option value="+">+</option>
			<option value="-">-</option>
			<option value="*">*</option>
			<option value="/">/</option>
			<option value="%">%</option>
		</select>
		<input id="num2Input" type="text"/>
		<button onclick="exec()">计算</button>
		<p>
			<input id="result" type="text"/>
		</p>
	</body>
	
	<script>
		function exec(){
			var num1 = Number(num1Input.value);
			var num2 = Number(num2Input.value);
			var op = signSelect.value;
			
			switch(op) {
				case '+' : result.value = num1+num2; break;
				case '-' : result.value = num1-num2; break;
				case '*' : result.value = num1*num2; break;
				case '/' : result.value = num1/num2; break;
				case '%' : result.value = num1%num2; break;
			}
		}
	</script>
	
	
</html>



